import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;



public class Main {
	
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		while(true) {
			String str = br.readLine();
			if(str.trim().equals("0 0")) {
				break;
			}
			StringTokenizer sToken = new StringTokenizer(str, " ");
			long a = Long.parseLong(sToken.nextToken());
			long b = Long.parseLong(sToken.nextToken());
			long gcd = findLCM(a, b);
			System.out.println((gcd / a) * (gcd / b
					));
		}
	}
	
	public static long findLCM(long a, long b) {
		if(a == 1 || b == 1) {
			return a * b;
		} else if (b % a == 0) {
			return a * findLCM(a / a, b / a);
		} else if (a % b == 0) {
			return b * findLCM(a / b, b/ b);
		} else {
			for(int i = 2; i <= Math.max(a, b) / 2; i++) {
				if(a % i == 0 && b % i == 0) {
					return i * findLCM(a / i, b / i);
				}
			}
		}
		return a * b;
	}
}